from flask import Flask, session, redirect, url_for, escape, request, jsonify
from . import router

app = Flask(__name__)

app.config["JSON_AS_ASCII"] = False
app.debug = False


@app.route("/")
def route_root():
    return 'znms2024 web server.'


@app.route("/znapi/<category>/<method>")
def route_info(category, method):
    result = {
        "version": "znms2024",
        "category": category,
        "method": method,
        "status": 0,
        "datas": {},
        "params": {},
        "error": ""
    }
    try:
        router.router.callApi(result, request)
    except Exception as error:
        print(error)
    return jsonify(result)


if __name__ == '__main__':
    print('00000000000000000000000000000000000000000000000000000000000000000000')
    app.run(debug=True, port=2000)

